import { createRouter, createWebHistory } from 'vue-router'

const globalRoutes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/common/login.vue'),
    meta: { title: '登录' } 
  }
]

const mainRoutes = [
  {
    path: '/',
    name: 'home',
    component: () => import('../views/home.vue'),
    meta: { title: '首页' },
  }
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: globalRoutes.concat(mainRoutes),
  scrollBehavior (to, from, savedPosition) {
    return {
      x: 0,
      y: 0
    }
  },
})

export default router
